<h1 id="introduction">Introduction</h1>
<p>This document is an installation guide for <em>Chisel</em> (Constructing Hardware In a Scala Embedded Language) and is intended to prepare your system for subsequent tutorials. Chisel is a hardware construction language embedded in the high-level programming language Scala.</p>
<h2 id="development-tool-installation">Development Tool Installation</h2>
<p>If you are running Mac or a variant of Linux, you will need to install the appropriate tools for your OS, which are described in the following sections:</p>
<h3 id="macosx">MacOSX</h3>
<ol style="list-style-type: decimal">
<li>Install XCODE, including console tools.</li>
</ol>
<h3 id="linux">Linux</h3>
<p>Install the following packages:</p>
<ol style="list-style-type: decimal">
<li><code>g++</code></li>
<li><code>openjdk-7-jre</code></li>
</ol>
<p>using</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">sudo</span> apt-get install</code></pre>
<h1 id="setting-up-the-tutorial">Setting Up the Tutorial</h1>
<p>In subsequent tutorials, you will be using the files distributed in the chisel-tutorial repository. To obtain these tutorials files, <code>cd</code> to the directory = <code>$DIR</code> where you want to place the Chisel tutorial and type:</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> <span class="ot">$DIR</span>
<span class="kw">git</span> clone https://github.com/ucb-bar/chisel-tutorial.git</code></pre>
<p>Your copy of the Chisel Tutorial repository will then be in <code>$DIR/chisel-tutorial</code>. Define this as a variable in your bash environment named <code>$TUT_DIR</code>.</p>
<p>This is the Chisel tutorial directory structure you should see, which is explained more in the next tutorial:</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">chisel-tutorial/</span>  
  <span class="kw">Makefile</span>
  <span class="kw">examples/</span>
    <span class="kw">Makefile</span>
    <span class="kw">build.sbt</span>
    <span class="kw">Accumulator.scala</span> ...
  <span class="kw">problems/</span>
    <span class="kw">Makefile</span>
    <span class="kw">build.sbt</span>
    <span class="kw">Counter.scala</span> ...
  <span class="kw">solutions/</span>
    <span class="kw">Makefile</span>
    <span class="kw">build.sbt</span>
    <span class="kw">Counter.scala</span> ...</code></pre>
<p>The following tutorials will explain features of Chisel by presenting source code examples. The repository is split into examples, problems, and solutions, where the problems have some piece of the design for you to fill out and where the examples and solutions are meant to be complete designs that should pass the given tests. In order to run either, you simply need to change directory into the appropriate subdirectory and type <code>make</code> of the particular lesson name. We will use the repository to first test out if your machine is set up to use Chisel.</p>
<p>To test your Chisel distribution and verify that your system contains all the correct tools, run the following commands:</p>
<pre class="sourceCode bash"><code class="sourceCode bash"><span class="kw">cd</span> <span class="ot">$TUT_DIR</span>/examples
<span class="kw">make</span> Parity.out</code></pre>
<p>This will run a test build and will take a minute before it completes. If your system is set up correctly, you should see a messsage <code>[success]</code> followed by the total time of the run, and date and time of completion. If you see a success than your system has been set up correctly and you can continute to the next tutorial where we will explain more about the basics of Chisel.</p>
<h1 id="the-tutorials">The Tutorials</h1>
<p>For these tutorials, we assume basic knowledge of digital circuits and blocks. Tutorial 1 will guide you through a quick compilation of the emulator and Verilog generation, and explain some basic constructs such as register and combinational logic. Tutorial 2 will explain the basics of Chisel. Tutorial 3 will explain how to use basic primitive types and logical operations that are used in Chisel and how to use them in context of several examples. Tutorial 4 will explain how to instantiate components and apply parametrization. Tutorial 5 will explain how to use the Chisel test harness. Tutorial 6 will explain how to set up your own Chisel project and how to build it. Tutorial 7 will revisit conditional register updates and explain how to construct memories. Finally, tutorial 8 will introduce how to use Scala constructs such as <code>if...else</code> and <code>for</code> loops.</p>
<p>The following set of tutorials were written using the build settings Scala version 2.10 and Chisel version 2.1.</p>
